package components.utils
{
    import fl.motion.Color;
    
    import flash.display.DisplayObject;
    import flash.geom.ColorTransform;

    public class ColorUtil
    {
		/**
		 *亮度值 
		 */
		public static const BRIGHTNESS_NUM:Number=0.3;
		
        public static function tint(obj:DisplayObject, tintColor:uint, tintMultiplier:Number):void
        {
            var color:Color = new Color();
            color.setTint(0xD9823E, 0.17);
            obj.transform.colorTransform = color as ColorTransform;
        }

        public static function brightness(obj:DisplayObject, b:Number=BRIGHTNESS_NUM):void
        {
            var color:Color = new Color();
            color.brightness = b;
            obj.transform.colorTransform = color as ColorTransform;
        }
		
		public static function advanced(obj:DisplayObject, redMultiplier:Number=1.0, greenMultiplier:Number=1.0, blueMultiplier:Number=1.0, alphaMultiplier:Number=1.0, redOffset:Number=0, greenOffset:Number=0, blueOffset:Number=0, alphaOffset:Number=0):void
		{
			var color:Color = new Color(redMultiplier,greenMultiplier,blueMultiplier,alphaMultiplier,redOffset,greenOffset,blueOffset,alphaOffset);
			obj.transform.colorTransform = color as ColorTransform;
		}
		
		public static function restore(obj:DisplayObject):void
		{
			obj.transform.colorTransform =new ColorTransform();
		}
    }
}
